<template>
	<view>
		<view v-for="(item,index) in dataList" class="item f-c-b themeBac cwhite f30">
			<view class="left f-c">
				<image :src="item.imgUrl" mode="widthFix"></image>
				<text>{{item.name}}</text>
			</view>
			
			<view @click="flag[index]=='已授权'?toBack(index):$to(`../account-information/account-information?type=${index}`)" class="">
				{{flag[index]}}
				<!-- <text>{{flag[index]?'已授权':'点击授权'}}</text> -->
				<!-- <u-icon v-show="!flag[index]" name="arrow-right"></u-icon> -->
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				dataList:[
					{
						imgUrl:'../../static/pays/icon_wx.png',
						name:"微信支付"
					},{
						imgUrl:'../../static/pays/icon_zfb.png',
						name:"支付宝支付"
					}
				],
				flag:[],
			}
		},
		// onLoad() {
		// 	this.withdrawalWay()
		// },
		onShow() {
			this.withdrawalWay()
		},
		methods: {
			async withdrawalWay(){
				const res=await this.$u.api.withdrawalWay({
					id:this.vuex_user.id
				})
				console.log(res);
				this.flag=[res.wechat==0?'点击授权 >':'已授权',res.alipay==0?'点击授权 >':'已授权']
				console.log(this.flag);
			},
			toBack(index){
				console.log(index);
				uni.$emit('type',index===0?'微信':'支付宝')
				this.$back(1)
			}
		}
	}
</script>

<style>
.left image{
	width: 60rpx;
	margin-right: 20rpx;
}
.item{
	margin: 30rpx 0;
	padding: 15rpx 30rpx;
}
</style>
